<template>
    <div v-if="isShow">
        <slot name="header"></slot>
        弹框
        <slot name="footer" :isShow="isShow" a="1" b="2"></slot>
    </div>
</template>
<script>
export default{
    data(){
        return {
            isShow:true
        }
    },
    mounted(){
        this.fn = function(arg){
            console.log(arg)
        }
        //子组件等待App.vue挂载完成
        this.$bus.$on('监听事件',this.fn)

        this.$nextTick(()=>{
            this.$bus.$emit('子触发父','通过$nextTick')
        })
        
    },
    methods:{
        change(){
            this.isShow = !this.isShow;
        }
    },
    beforeDestroy(){
        this.$bus.$off('监听事件',this.fn)
    }
}
</script>
